<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/form/base.css'); ?>
<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/form/offer.css'); ?>
<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/offer.css') ?>
<?= $this->render('offer/add-breadcrumbs.phtml') ?>
<h4><?= $this->translate('XXX_OFFER_ADD_STEP_PREVIEW_TITLE') ?></h4>
<div class="offer_add">

    <div class="offer_preview clearfix">
        <?php
        $this->addMode = true;
        echo $this->render('offer/show-partial.phtml');
        ?>
    </div>

    <div class="wizard-action row-fluid">
        <form class="form offer-add-form " action="<?= $this->url(array('controller' => 'offer', 'action' => 'add', 'token' => $this->token), 'default', true) ?>" method="post" enctype="application/x-www-form-urlencoded">
            <div class="form_elements row-fluid">
                <fieldset id="fieldset-action">
                    <div class="span12 row-fluid row-type-submit row-submit info">
                        <div class="agreement <?= isset($this->agreementRequired) && $this->agreementRequired ? 'error' : '' ?>">
                            <input id="agreement" type="checkbox" name="agreement" value="1" />
                            <label for="agreement"><?= $this->translate('XXX_OFFER_ADD_AGREEMENT_TEXT', $this->url(array('controller' => 'static', 'id' => 'offer-terms'), 'default', true)) ?></label>
                        </div>
                        <div class="data type-submit element-submit">
                            <a href="<?= $this->url(array('controller' => 'offer', 'action' => 'step-prev', 'token' => $this->token), 'default', true) ?>" class=" form-cancel form-cancel-left">Wstecz</a>
                            <input type="submit" class="btn btn-primary btn-large submit form_button button " value="<?= ($this->bean->type == 'free') ? 'Opublikuj' : 'Opłać i opublikuj' ?>" id="submit" name="submit">
                        </div>
                    </div>
                </fieldset>
                <input type="hidden" name="step" value="next" />
            </div>
        </form>   
    </div>
</div>

<script type="text/javascript">
    $(function() {
        $('.offer_add').on('submit', 'form.form', function(event) {
            var agr = $('input#agreement', $(this)).is(':checked');
            if(!agr) {
                $('div.agreement', $(this)).addClass('error');
                return false;
            }
        });
    });
</script>